package com.wxb.note.catty;

import java.math.BigDecimal;
import java.math.MathContext;

/**
 * @author wxb
 * 规则： 满100 减 10
 */
public class ActiveOne implements ICatty {

    // 用于装饰增强
    private ICatty catty;

    public ActiveOne(){}

    public ActiveOne(ICatty catty){
        this.catty = catty;
    }
    @Override
    public BigDecimal calculation(BigDecimal totalPrice) {
        return totalPrice.doubleValue() >= 100.0 ? totalPrice.subtract(new BigDecimal("10"), MathContext.DECIMAL64): totalPrice;
    }
}
